<!DOCTYPE HTML>
<html lang="zh-CN">


<head>
    <meta charset="utf-8">
    <meta name="keywords" content="C语言课程实训：员工信息管理系统, 十二惊惶的gitee">
    <meta name="description" content="1.需求分析&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;一家公司不仅应该有管理者，还应该有数量更多的普通员工，一个员工信息管理系统，不仅要有管理员操作的模块还要有员工模块。
1.1员工登录&amp;nbsp;&amp;nbsp;">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
    <meta name="renderer" content="webkit|ie-stand|ie-comp">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <meta name="referrer" content="no-referrer-when-downgrade">
    <!-- Global site tag (gtag.js) - Google Analytics -->


    <title>C语言课程实训：员工信息管理系统 | 十二惊惶的gitee</title>
    <link rel="icon" type="image/png" href="/shier_jinghuang/favicon.png">
    


    <!-- bg-cover style     -->



<link rel="stylesheet" type="text/css" href="/shier_jinghuang/libs/awesome/css/all.min.css">
<link rel="stylesheet" type="text/css" href="/shier_jinghuang/libs/materialize/materialize.min.css">
<link rel="stylesheet" type="text/css" href="/shier_jinghuang/libs/aos/aos.css">
<link rel="stylesheet" type="text/css" href="/shier_jinghuang/libs/animate/animate.min.css">
<link rel="stylesheet" type="text/css" href="/shier_jinghuang/libs/lightGallery/css/lightgallery.min.css">
<link rel="stylesheet" type="text/css" href="/shier_jinghuang/css/matery.css">
<link rel="stylesheet" type="text/css" href="/shier_jinghuang/css/my.css">
<link rel="stylesheet" type="text/css" href="/shier_jinghuang/css/dark.css" media="none" onload="if(media!='all')media='all'">




    <link rel="stylesheet" href="/shier_jinghuang/libs/tocbot/tocbot.css">
    <link rel="stylesheet" href="/shier_jinghuang/css/post.css">




    



    <script src="/shier_jinghuang/libs/jquery/jquery-3.6.0.min.js"></script>

<meta name="generator" content="Hexo 5.4.0"><link rel="alternate" href="/shier_jinghuang/atom.xml" title="十二惊惶的gitee" type="application/atom+xml">
</head>


<body>
    <header class="navbar-fixed">
    <nav id="headNav" class="bg-color nav-transparent">
        <div id="navContainer" class="nav-wrapper container">
            <div class="brand-logo">
                <a href="/shier_jinghuang/" class="waves-effect waves-light">
                    
                    <img src="/shier_jinghuang/medias/1.jpg" class="logo-img" alt="LOGO">
                    
                    <span class="logo-span">十二惊惶的gitee</span>
                </a>
            </div>
            

<a href="#" data-target="mobile-nav" class="sidenav-trigger button-collapse"><i class="fas fa-bars"></i></a>
<ul class="right nav-menu">
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/shier_jinghuang/" class="waves-effect waves-light">
      
      <i class="fas fa-home" style="zoom: 0.6;"></i>
      
      <span>首页</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/shier_jinghuang/tags" class="waves-effect waves-light">
      
      <i class="fas fa-tags" style="zoom: 0.6;"></i>
      
      <span>标签</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/shier_jinghuang/categories" class="waves-effect waves-light">
      
      <i class="fas fa-bookmark" style="zoom: 0.6;"></i>
      
      <span>分类</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/shier_jinghuang/archives" class="waves-effect waves-light">
      
      <i class="fas fa-archive" style="zoom: 0.6;"></i>
      
      <span>归档</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/shier_jinghuang/about" class="waves-effect waves-light">
      
      <i class="fas fa-user-circle" style="zoom: 0.6;"></i>
      
      <span>关于</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/shier_jinghuang/contact" class="waves-effect waves-light">
      
      <i class="fas fa-comments" style="zoom: 0.6;"></i>
      
      <span>留言板</span>
    </a>
    
  </li>
  
  <li class="hide-on-med-and-down nav-item">
    
    <a href="/shier_jinghuang/friends" class="waves-effect waves-light">
      
      <i class="fas fa-address-book" style="zoom: 0.6;"></i>
      
      <span>友情链接</span>
    </a>
    
  </li>
  
  <li>
    <a href="#searchModal" class="modal-trigger waves-effect waves-light">
      <i id="searchIcon" class="fas fa-search" title="搜索" style="zoom: 0.85;"></i>
    </a>
  </li>
  <li>
    <a href="javascript:;" class="waves-effect waves-light" onclick="switchNightMode()" title="深色/浅色模式" >
      <i id="sum-moon-icon" class="fas fa-sun" style="zoom: 0.85;"></i>
    </a>
  </li>
</ul>


<div id="mobile-nav" class="side-nav sidenav">

    <div class="mobile-head bg-color">
        
        <img src="/shier_jinghuang/medias/1.jpg" class="logo-img circle responsive-img">
        
        <div class="logo-name">十二惊惶的gitee</div>
        <div class="logo-desc">
            
            犁牛之子骍且角，虽欲勿用，山川其舍诸
            
        </div>
    </div>

    <ul class="menu-list mobile-menu-list">
        
        <li class="m-nav-item">
	  
		<a href="/shier_jinghuang/" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-home"></i>
			
			首页
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/shier_jinghuang/tags" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-tags"></i>
			
			标签
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/shier_jinghuang/categories" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-bookmark"></i>
			
			分类
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/shier_jinghuang/archives" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-archive"></i>
			
			归档
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/shier_jinghuang/about" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-user-circle"></i>
			
			关于
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/shier_jinghuang/contact" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-comments"></i>
			
			留言板
		</a>
          
        </li>
        
        <li class="m-nav-item">
	  
		<a href="/shier_jinghuang/friends" class="waves-effect waves-light">
			
			    <i class="fa-fw fas fa-address-book"></i>
			
			友情链接
		</a>
          
        </li>
        
        
        <li><div class="divider"></div></li>
        <li>
            <a href="https://gitee.com/Im-so-scared-2/shier_jinghuang" class="waves-effect waves-light" target="_blank">
                <i class="fab fa-github-square fa-fw"></i>十二惊惶
            </a>
        </li>
        
    </ul>
</div>


        </div>

        
            <style>
    .nav-transparent .github-corner {
        display: none !important;
    }

    .github-corner {
        position: absolute;
        z-index: 10;
        top: 0;
        right: 0;
        border: 0;
        transform: scale(1.1);
    }

    .github-corner svg {
        color: #0f9d58;
        fill: #fff;
        height: 64px;
        width: 64px;
    }

    .github-corner:hover .octo-arm {
        animation: a 0.56s ease-in-out;
    }

    .github-corner .octo-arm {
        animation: none;
    }

    @keyframes a {
        0%,
        to {
            transform: rotate(0);
        }
        20%,
        60% {
            transform: rotate(-25deg);
        }
        40%,
        80% {
            transform: rotate(10deg);
        }
    }
</style>

<a href="https://gitee.com/Im-so-scared-2/shier_jinghuang" class="github-corner tooltipped hide-on-med-and-down" target="_blank"
   data-tooltip="十二惊惶" data-position="left" data-delay="50">
    <svg viewBox="0 0 250 250" aria-hidden="true">
        <path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
        <path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
              fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path>
        <path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
              fill="currentColor" class="octo-body"></path>
    </svg>
</a>
        
    </nav>

</header>

    



<div class="bg-cover pd-header post-cover" style="background-image: url('/shier_jinghuang/medias/featureimages/12.jpg')">
    <div class="container" style="right: 0px;left: 0px;">
        <div class="row">
            <div class="col s12 m12 l12">
                <div class="brand">
                    <h1 class="description center-align post-title">C语言课程实训：员工信息管理系统</h1>
                </div>
            </div>
        </div>
    </div>
</div>




<main class="post-container content">

    
    <div class="row">
    <div id="main-content" class="col s12 m12 l9">
        <!-- 文章内容详情 -->
<div id="artDetail">
    <div class="card">
        <div class="card-content article-info">
            <div class="row tag-cate">
                <div class="col s7">
                    
                    <div class="article-tag">
                        
                            <a href="/shier_jinghuang/tags/C/">
                                <span class="chip bg-color">C</span>
                            </a>
                        
                            <a href="/shier_jinghuang/tags/%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1/">
                                <span class="chip bg-color">程序设计</span>
                            </a>
                        
                    </div>
                    
                </div>
                <div class="col s5 right-align">
                    
                    <div class="post-cate">
                        <i class="fas fa-bookmark fa-fw icon-category"></i>
                        
                            <a href="/shier_jinghuang/categories/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" class="post-category">
                                学习笔记
                            </a>
                        
                    </div>
                    
                </div>
            </div>

            <div class="post-info">
                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-minus fa-fw"></i>发布日期:&nbsp;&nbsp;
                    2021-07-31
                </div>
                

                
                <div class="post-date info-break-policy">
                    <i class="far fa-calendar-check fa-fw"></i>更新日期:&nbsp;&nbsp;
                    2021-12-11
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-file-word fa-fw"></i>文章字数:&nbsp;&nbsp;
                    12.1k
                </div>
                

                
                <div class="info-break-policy">
                    <i class="far fa-clock fa-fw"></i>阅读时长:&nbsp;&nbsp;
                    58 分
                </div>
                

                
                    <div id="busuanzi_container_page_pv" class="info-break-policy">
                        <i class="far fa-eye fa-fw"></i>阅读次数:&nbsp;&nbsp;
                        <span id="busuanzi_value_page_pv"></span>
                    </div>
				
            </div>
        </div>
        <hr class="clearfix">

        
        <!-- 是否加载使用自带的 prismjs. -->
        <link rel="stylesheet" href="/shier_jinghuang/libs/prism/prism.min.css">
        

        

        <div class="card-content article-card-content">
            <div id="articleContent">
                <h2 id="1-需求分析"><a href="#1-需求分析" class="headerlink" title="1.需求分析"></a>1.需求分析</h2><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一家公司不仅应该有管理者，还应该有数量更多的普通员工，一个员工信息管理系统，不仅要有管理员操作的模块还要有员工模块。</p>
<h4 id="1-1员工登录"><a href="#1-1员工登录" class="headerlink" title="1.1员工登录"></a>1.1员工登录</h4><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这一部分需要实现员工自主查询信息的功能，但要求不能使员工更改数据库中的信息</p>
<h4 id="1-2管理员登录"><a href="#1-2管理员登录" class="headerlink" title="1.2管理员登录"></a>1.2管理员登录</h4><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;这一部分要实现管理员对员工信息的管理，包括：新建员工信息、浏览员工信息、以员工号或姓名的方式查询员工信息、删除员工信息、根据各种方式筛选相应员工、修改员工信息以及退出该管理服务系统等等。每一步都将相应的数据存入二进制文件中。</p>
<h2 id="2-系统设计"><a href="#2-系统设计" class="headerlink" title="2.系统设计"></a>2.系统设计</h2><h3 id="nbsp-nbsp-nbsp-2-1实现员工登陆查询信息系统"><a href="#nbsp-nbsp-nbsp-2-1实现员工登陆查询信息系统" class="headerlink" title="&nbsp;&nbsp;&nbsp;2.1实现员工登陆查询信息系统"></a>&nbsp;&nbsp;&nbsp;2.1实现员工登陆查询信息系统</h3><h3 id="nbsp-nbsp-nbsp-2-2实现管理员登录管理系统"><a href="#nbsp-nbsp-nbsp-2-2实现管理员登录管理系统" class="headerlink" title="&nbsp;&nbsp;&nbsp;2.2实现管理员登录管理系统"></a>&nbsp;&nbsp;&nbsp;2.2实现管理员登录管理系统</h3><h5 id="nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-模块一：实现新建职工信息功能；"><a href="#nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-模块一：实现新建职工信息功能；" class="headerlink" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块一：实现新建职工信息功能；"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块一：实现新建职工信息功能；</h5><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;以追加的形式将数据存入二进制文件，并且将从文本文件中读取的num值自增，并将num重新存入文本文件中。</p>
<h5 id="nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-模块二：实现浏览员工信息功能；"><a href="#nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-模块二：实现浏览员工信息功能；" class="headerlink" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块二：实现浏览员工信息功能；"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块二：实现浏览员工信息功能；</h5><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一开始计划是只是浏览全部的员工信息，在后期的制作中，想到一个公司往往会有各种活动，需要对参与员工进行筛选，对其追加了根据年龄，工资性别的筛选功能。</p>
<h5 id="nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-模块三：实现查询员工信息功能；"><a href="#nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-nbsp-模块三：实现查询员工信息功能；" class="headerlink" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块三：实现查询员工信息功能；"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块三：实现查询员工信息功能；</h5><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;对员工信息的查询功能包括两个方面，按员工号进行查询和按照姓名方式进行查询如果查询失败则输出没有该员工，返回操作页面。</p>
<h5 id="模块四：实现删除员工信息功能；"><a href="#模块四：实现删除员工信息功能；" class="headerlink" title="模块四：实现删除员工信息功能；"></a>模块四：实现删除员工信息功能；</h5><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;从二进制文件中将数据全部读取出来，将输入的员工号与已有数据中的员工号进行比对，当数据相同时删除该员工信息，并将全部信息重新写入文件中。</p>
<h4 id="nbsp-nbsp-nbsp-nbsp-nbsp-模块五：实现修改员工信息功能；"><a href="#nbsp-nbsp-nbsp-nbsp-nbsp-模块五：实现修改员工信息功能；" class="headerlink" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块五：实现修改员工信息功能；"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块五：实现修改员工信息功能；</h4><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;该模块具体执行数据的修改，分成八个部分修改员工的各种信息。</p>
<h4 id="nbsp-nbsp-nbsp-nbsp-nbsp-模块六：实现退出服务系统功能；"><a href="#nbsp-nbsp-nbsp-nbsp-nbsp-模块六：实现退出服务系统功能；" class="headerlink" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块六：实现退出服务系统功能；"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块六：实现退出服务系统功能；</h4><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;用于结束程序的模块</p>
<h4 id="nbsp-nbsp-nbsp-nbsp-nbsp-模块七：实现读取已存入数据个数"><a href="#nbsp-nbsp-nbsp-nbsp-nbsp-模块七：实现读取已存入数据个数" class="headerlink" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块七：实现读取已存入数据个数"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块七：实现读取已存入数据个数</h4><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;由于使用了一个文本文件进行辅助工作，这个程序这是读取txt格式文本文件中存储的数字，将他存入全局变量num中。</p>
<h4 id="nbsp-nbsp-nbsp-nbsp-nbsp-模块八：管理员登录后的操作页面；"><a href="#nbsp-nbsp-nbsp-nbsp-nbsp-模块八：管理员登录后的操作页面；" class="headerlink" title="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块八：管理员登录后的操作页面；"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;模块八：管理员登录后的操作页面；</h4><h2 id="3-详细代码"><a href="#3-详细代码" class="headerlink" title="3.详细代码"></a>3.详细代码</h2><h4 id="nbsp-nbsp-nbsp-3-1-1company-h"><a href="#nbsp-nbsp-nbsp-3-1-1company-h" class="headerlink" title="&nbsp;&nbsp;&nbsp;3.1.1company.h"></a>&nbsp;&nbsp;&nbsp;3.1.1company.h</h4><pre class="line-numbers language-none"><code class="language-none">#include&lt;stdio.h&gt;
#include&lt;string.h&gt;
#include&lt;math.h&gt;
#include&lt;stdlib.h&gt;
#include &lt;ctype.h&gt;
#include&lt;windows.h&gt;
#include&lt;conio.h&gt;
static int NUM;
struct workers
&#123;
        char jobNo[20];       &#x2F;&#x2F;工号
        char name[15];        &#x2F;&#x2F;姓名
        char sex[15];         &#x2F;&#x2F;性别
        char year[15];        &#x2F;&#x2F;年龄
        char position[15];    &#x2F;&#x2F;职务
        char salary[15];      &#x2F;&#x2F;工资
        char addr[15];        &#x2F;&#x2F;住址
        char tel[15];         &#x2F;&#x2F;电话
&#125;;
void f_1(struct workers *workers);
void f_2(struct workers *workers);
void f_3(struct workers *n);
void f_3_2(struct workers *workers);
void f_3_1(struct workers *workers);
int  f_4(struct workers *workers);
void f_5(struct workers *workers);
int f_6(char n);
void see (void);
void xtjz(void);
int sign(void);
int Hollow(void);<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h4 id="nbsp-nbsp-nbsp-3-1-2company-c"><a href="#nbsp-nbsp-nbsp-3-1-2company-c" class="headerlink" title="&nbsp;&nbsp;&nbsp;3.1.2company.c"></a>&nbsp;&nbsp;&nbsp;3.1.2company.c</h4><pre class="line-numbers language-c" data-language="c"><code class="language-c"><span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">&lt;stdio.h></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">&lt;string.h></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">&lt;math.h></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">&lt;stdlib.h></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span> <span class="token string">&lt;ctype.h></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">&lt;windows.h></span></span>
<span class="token macro property"><span class="token directive-hash">#</span><span class="token directive keyword">include</span><span class="token string">"gongshi.h"</span></span>
<span class="token keyword">void</span> <span class="token function">smile</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token comment">//1、系统加载界面</span>
<span class="token punctuation">&#123;</span>
    <span class="token keyword">int</span> i<span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n\n\n\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t\t\t系统加载中\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span>i <span class="token operator">=</span> <span class="token number">0</span><span class="token punctuation">;</span> i <span class="token operator">&lt;</span><span class="token number">20</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"$ "</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span>i <span class="token operator">==</span><span class="token number">19</span><span class="token punctuation">)</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">Sleep</span><span class="token punctuation">(</span><span class="token number">100</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token comment">//使计算机进入短暂的休眠状态100毫秒</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n\n\n\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t\t\t系统加载完成！\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t\t\t  欢迎使用！\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">Sleep</span><span class="token punctuation">(</span><span class="token number">500</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span><span class="token comment">//执行清屏操作</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">int</span> <span class="token function">sign</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token punctuation">)</span>
<span class="token punctuation">&#123;</span>
    <span class="token keyword">int</span> n<span class="token punctuation">;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>workers<span class="token punctuation">;</span>
    workers <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token operator">*</span><span class="token punctuation">)</span><span class="token function">malloc</span><span class="token punctuation">(</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t=============================================================\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                  《职工信息管理系统》                   ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                 请按相应按键使用本系统！                ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   1.员工登录                       2.管理员模式         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t=============================================================\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>n<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">char</span> number<span class="token punctuation">[</span><span class="token number">9</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">char</span> pow<span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>n<span class="token operator">==</span><span class="token number">2</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入管理员账号"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>number<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">fflush</span><span class="token punctuation">(</span><span class="token constant">stdin</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入密码"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#123;</span>
            <span class="token keyword">for</span><span class="token punctuation">(</span><span class="token keyword">int</span> i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span><span class="token number">9</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                pow<span class="token punctuation">[</span>i<span class="token punctuation">]</span> <span class="token operator">=</span> <span class="token function">getch</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token comment">/*逐次赋值,但不回显*/</span>
                <span class="token keyword">if</span> <span class="token punctuation">(</span>pow<span class="token punctuation">[</span>i<span class="token punctuation">]</span> <span class="token operator">==</span> <span class="token string">'\x0d'</span><span class="token punctuation">)</span>
                    <span class="token comment">/*回车则终止循环*/</span>
                <span class="token punctuation">&#123;</span>
                    pow<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token operator">=</span><span class="token string">'\0'</span><span class="token punctuation">;</span>
                    <span class="token keyword">break</span><span class="token punctuation">;</span>
                <span class="token punctuation">&#125;</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"*"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>       <span class="token comment">/*以星号代替字符个数*/</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">fflush</span><span class="token punctuation">(</span><span class="token constant">stdin</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>number<span class="token punctuation">,</span><span class="token string">"0001"</span><span class="token punctuation">)</span><span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span> <span class="token operator">&amp;&amp;</span> <span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>pow<span class="token punctuation">,</span><span class="token string">"123456"</span><span class="token punctuation">)</span><span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                <span class="token keyword">return</span> n<span class="token punctuation">;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token keyword">else</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"账号或密码错误!"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>n<span class="token operator">==</span><span class="token number">1</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">f_3</span> <span class="token punctuation">(</span>workers<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">return</span> n<span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">else</span>
    <span class="token punctuation">&#123;</span>
        <span class="token keyword">int</span> n<span class="token punctuation">;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入正确的功能编号!\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">sign</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">void</span> <span class="token function">see</span> <span class="token punctuation">(</span><span class="token keyword">void</span><span class="token punctuation">)</span>
<span class="token comment">//该函数是从辅助文件中读取员工个数；</span>
<span class="token punctuation">&#123;</span>
    FILE <span class="token operator">*</span>fp1<span class="token punctuation">;</span>
    <span class="token keyword">char</span> ch<span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    fp1<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"data.txt"</span><span class="token punctuation">,</span><span class="token string">"r+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//data.txt为辅助的文本文件；</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp1<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"人数预存文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">fgets</span><span class="token punctuation">(</span>ch<span class="token punctuation">,</span><span class="token number">3</span><span class="token punctuation">,</span>fp1<span class="token punctuation">)</span><span class="token punctuation">;</span>
    NUM<span class="token operator">=</span><span class="token function">atoi</span><span class="token punctuation">(</span>ch<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp1<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">int</span> <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token keyword">void</span><span class="token punctuation">)</span>
<span class="token comment">//管理员页面，在程序中会反复调用；</span>
<span class="token punctuation">&#123;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n\n\n\t\t\t=============================================================\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                   《职工信息管理系统》                  ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                       管理员页面！                      ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   1.新建职工信息                 2.浏览职工信息         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   3.查询职工信息                 4.删除职工信息         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   5.变更职工信息                 6.退出程序             ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t=============================================================\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">int</span> <span class="token function">f_6</span><span class="token punctuation">(</span><span class="token keyword">char</span> n<span class="token punctuation">)</span>
<span class="token comment">//退出程序；</span>
<span class="token punctuation">&#123;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"感谢您使用本系统，祝您工作愉快\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">return</span> <span class="token number">0</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">void</span> <span class="token function">f_1</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>workers<span class="token punctuation">)</span>
<span class="token comment">//以尾加法插入新的数据，并写入text.dat二进制文件中；</span>
<span class="token punctuation">&#123;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>p<span class="token punctuation">;</span>
    <span class="token comment">//p是个指向结构体指针后面需要用到；</span>
    p <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span><span class="token punctuation">)</span><span class="token function">malloc</span><span class="token punctuation">(</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//对指针p分配大小；</span>
    p<span class="token operator">=</span>workers<span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入员工号:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> p<span class="token operator">-></span>jobNo<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入姓名:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入性别:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入所担任职务:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> p<span class="token operator">-></span>position<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入年龄："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>p<span class="token operator">-></span>year<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入工资:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入家庭住址："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入员工联系方式："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
    FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"ab+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token comment">//这段程序是结束函数块的，如果没有这段代码后面内容还会继续输出。</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">fwrite</span><span class="token punctuation">(</span>workers<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">1</span><span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//将数据存入函数中；</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">char</span> ch<span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    NUM<span class="token operator">++</span><span class="token punctuation">;</span>
    <span class="token function">sprintf</span><span class="token punctuation">(</span>ch<span class="token punctuation">,</span><span class="token string">"%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>NUM<span class="token punctuation">)</span><span class="token punctuation">;</span>
    FILE <span class="token operator">*</span>fp1<span class="token punctuation">;</span>
    fp1<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"data.txt"</span><span class="token punctuation">,</span><span class="token string">"w+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">itoa</span><span class="token punctuation">(</span>NUM<span class="token punctuation">,</span>ch<span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//一个没学过的函数，把整形数转化成字符型；</span>
    <span class="token function">fputs</span><span class="token punctuation">(</span>ch<span class="token punctuation">,</span>fp1<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp1<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">/*
    使用外部变量NUM，在使用者使用程序时先行为，NUM赋值；
    */</span>
    <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">void</span> <span class="token function">f_2</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>workers<span class="token punctuation">)</span>
<span class="token comment">//浏览已经写入的数据；</span>
<span class="token punctuation">&#123;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
   <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n\n\n\t\t\t=============================================================\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   1.浏览全部信息                 2.按性别方式筛选       ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   3.按年龄方式筛选               4.按薪资筛选           ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t=============================================================\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> n<span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入筛选的方式\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>n<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>n<span class="token operator">==</span><span class="token number">1</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token operator">*</span>p<span class="token punctuation">;</span>
        FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

        <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">int</span> i<span class="token punctuation">;</span>
        <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
            <span class="token keyword">if</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token punctuation">&#125;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>n<span class="token operator">==</span><span class="token number">2</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token keyword">int</span> k<span class="token punctuation">;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入要筛选的员工性别编号\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"1.男性    \t\t     2.女性\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>k<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token operator">*</span>p<span class="token punctuation">;</span>
        FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>k<span class="token operator">==</span><span class="token number">1</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token keyword">int</span> i<span class="token punctuation">;</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>sex<span class="token punctuation">,</span><span class="token string">"男"</span><span class="token punctuation">)</span><span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span>
                <span class="token punctuation">&#123;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token punctuation">&#125;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>k<span class="token operator">==</span><span class="token number">2</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token keyword">int</span> i<span class="token punctuation">;</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>sex<span class="token punctuation">,</span><span class="token string">"女"</span><span class="token punctuation">)</span><span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span>
                <span class="token punctuation">&#123;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token punctuation">&#125;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token keyword">else</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"你好像想查询什么奇奇怪怪的东西！\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>n<span class="token operator">==</span><span class="token number">3</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token keyword">int</span> k<span class="token punctuation">;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入要筛选的员工薪资范围\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"1.青年    \t\t     2.壮年\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>k<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token operator">*</span>p<span class="token punctuation">;</span>
        FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>k<span class="token operator">==</span><span class="token number">1</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token keyword">int</span> i<span class="token punctuation">;</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>

                <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">atoi</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>year<span class="token punctuation">)</span><span class="token operator">&lt;</span><span class="token number">30</span><span class="token punctuation">)</span>
                <span class="token punctuation">&#123;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token punctuation">&#125;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>k<span class="token operator">==</span><span class="token number">2</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token keyword">int</span> i<span class="token punctuation">;</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">atoi</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>year<span class="token punctuation">)</span><span class="token operator">></span><span class="token number">30</span><span class="token punctuation">)</span>
                <span class="token punctuation">&#123;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token punctuation">&#125;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token keyword">else</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"你好像想查询什么奇奇怪怪的东西！\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>n<span class="token operator">==</span><span class="token number">4</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token keyword">int</span> k<span class="token punctuation">;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入要筛选的员工薪资范围\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"1.低薪    \t\t     2.中薪\t\t\t  3.高薪\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>k<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token operator">*</span>p<span class="token punctuation">;</span>
        FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span> <span class="token punctuation">(</span>k<span class="token operator">==</span><span class="token number">1</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token keyword">int</span> i<span class="token punctuation">;</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">atoi</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>salary<span class="token punctuation">)</span><span class="token operator">&lt;</span><span class="token number">3000</span><span class="token punctuation">)</span>
                <span class="token punctuation">&#123;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token punctuation">&#125;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span> <span class="token punctuation">(</span>k<span class="token operator">==</span><span class="token number">2</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token keyword">int</span> i<span class="token punctuation">;</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">atoi</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>salary<span class="token punctuation">)</span><span class="token operator">>=</span><span class="token number">3000</span><span class="token operator">&amp;&amp;</span><span class="token function">atoi</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>salary<span class="token punctuation">)</span><span class="token operator">&lt;</span><span class="token number">8000</span><span class="token punctuation">)</span>
                <span class="token punctuation">&#123;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token punctuation">&#125;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token keyword">else</span> <span class="token keyword">if</span><span class="token punctuation">(</span>k<span class="token operator">==</span><span class="token number">3</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token keyword">int</span> i<span class="token punctuation">;</span>
            <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
                p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
                <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">atoi</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>salary<span class="token punctuation">)</span><span class="token operator">>=</span><span class="token number">8000</span><span class="token punctuation">)</span>
                <span class="token punctuation">&#123;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token punctuation">&#125;</span>
            <span class="token punctuation">&#125;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
        <span class="token keyword">else</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"你好像想查询什么奇奇怪怪的东西！\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">void</span> <span class="token function">f_3_1</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>n<span class="token punctuation">)</span>
<span class="token comment">//以员工号方式查询某个员工的信息。</span>
<span class="token punctuation">&#123;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token operator">*</span>p<span class="token punctuation">;</span>
    FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">char</span> found<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n请输入你要查询的职工的职工号："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> found<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> i<span class="token punctuation">;</span>
    <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span><span class="token number">100</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">,</span>found<span class="token punctuation">)</span><span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>i<span class="token operator">==</span><span class="token number">100</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"没有该员工！"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">void</span> <span class="token function">f_3</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>n<span class="token punctuation">)</span>
<span class="token comment">//以员工号方式查询某个员工的信息。</span>
<span class="token punctuation">&#123;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token operator">*</span>p<span class="token punctuation">;</span>
    FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">char</span> found<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n请输入你要查询的职工的职工号："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> found<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> i<span class="token punctuation">;</span>
    <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span><span class="token number">100</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">,</span>found<span class="token punctuation">)</span><span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>i<span class="token operator">==</span><span class="token number">100</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"没有该员工！"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">void</span> <span class="token function">f_3_2</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>n<span class="token punctuation">)</span>
<span class="token punctuation">&#123;</span>
    <span class="token comment">//以姓名方式查找员工；</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">,</span><span class="token operator">*</span>p<span class="token punctuation">;</span>
    FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span><span class="token number">100</span><span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">char</span> found<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n请输入你要查询的职工的姓名："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> found<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">int</span> i<span class="token punctuation">;</span>
    <span class="token keyword">for</span> <span class="token punctuation">(</span>i<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> i<span class="token operator">&lt;</span><span class="token number">100</span><span class="token punctuation">;</span> i<span class="token operator">++</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        p<span class="token operator">=</span><span class="token operator">&amp;</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>i<span class="token punctuation">]</span><span class="token punctuation">.</span>name<span class="token punctuation">,</span>found<span class="token punctuation">)</span><span class="token operator">==</span><span class="token number">0</span><span class="token punctuation">)</span>
            <span class="token comment">//用found数组进行比较如果found数组和name相同则执行；</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"——————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n "</span><span class="token punctuation">,</span>p<span class="token operator">-></span>jobNo<span class="token punctuation">,</span> p<span class="token operator">-></span>name<span class="token punctuation">,</span> p<span class="token operator">-></span>sex<span class="token punctuation">,</span> p<span class="token operator">-></span>year<span class="token punctuation">,</span>p<span class="token operator">-></span>position<span class="token punctuation">,</span> p<span class="token operator">-></span>salary<span class="token punctuation">,</span> p<span class="token operator">-></span>addr<span class="token punctuation">,</span> p<span class="token operator">-></span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"—————————————————————————————\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>i<span class="token operator">==</span><span class="token number">100</span><span class="token punctuation">)</span>
        <span class="token comment">//当</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"没有该员工！"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">int</span> <span class="token function">f_4</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>workers<span class="token punctuation">)</span>
<span class="token comment">//删除数据；</span>
<span class="token punctuation">&#123;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>p<span class="token punctuation">;</span>
    <span class="token keyword">int</span> j<span class="token punctuation">;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span><span class="token number">100</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">char</span> find<span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span>NUM<span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入要删除的职工号"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>find<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span>j<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> j<span class="token operator">&lt;=</span>NUM<span class="token punctuation">;</span> j<span class="token operator">++</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">,</span>find<span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            NUM<span class="token operator">--</span><span class="token punctuation">;</span>
            <span class="token comment">//将num--这个操作，更改变量的大小，方便再次存入。</span>
            <span class="token keyword">break</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span>NUM<span class="token operator">&lt;</span>j<span class="token punctuation">)</span>
        <span class="token comment">//如果没有提前结束，j的最终大小回是num+1;判断num是否及时结束。</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"该职工号不存在！"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">,</span>find<span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token keyword">for</span><span class="token punctuation">(</span>j<span class="token punctuation">;</span> j<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> j<span class="token operator">++</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">strcpy</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">strcpy</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>name<span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">strcpy</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>sex<span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>sex<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">strcpy</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>position<span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>position<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">strcpy</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>year<span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>year<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">strcpy</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>salary<span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>salary<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">strcpy</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>addr<span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>addr<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">strcpy</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>tel<span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token operator">+</span><span class="token number">1</span><span class="token punctuation">]</span><span class="token punctuation">.</span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
<span class="token comment">//将read[j]进行移位，达到删除的目的；</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//关闭文件</span>
    <span class="token keyword">char</span> ch<span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token comment">//定义一个</span>
    fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"wb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"删除失败！"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">fwrite</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span>NUM<span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    FILE <span class="token operator">*</span>fp1<span class="token punctuation">;</span>
    fp1<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"data.txt"</span><span class="token punctuation">,</span><span class="token string">"w+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//使用一个txt格式的文件作为辅助，进行数据量的计数。</span>
    <span class="token function">itoa</span><span class="token punctuation">(</span>NUM<span class="token punctuation">,</span>ch<span class="token punctuation">,</span> <span class="token number">10</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token comment">//一个没学过的函数，把整形数转化成字符型；</span>
    <span class="token function">fputs</span><span class="token punctuation">(</span>ch<span class="token punctuation">,</span>fp1<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp1<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">&#125;</span>
<span class="token keyword">void</span> <span class="token function">f_5</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>workers<span class="token punctuation">)</span>
<span class="token comment">//在文件中读取数据，对数据进行修改，最后在存入文件中。</span>
<span class="token punctuation">&#123;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span>p<span class="token punctuation">;</span>
    <span class="token keyword">int</span> j<span class="token punctuation">;</span>
    <span class="token keyword">struct</span> <span class="token class-name">workers</span> read<span class="token punctuation">[</span>NUM<span class="token punctuation">]</span><span class="token punctuation">;</span>
    <span class="token keyword">char</span> find<span class="token punctuation">[</span><span class="token number">10</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
    FILE <span class="token operator">*</span>fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"rb"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件打开失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">fread</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span>NUM<span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入要修改的职工号"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>find<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">for</span><span class="token punctuation">(</span>j<span class="token operator">=</span><span class="token number">0</span><span class="token punctuation">;</span> j<span class="token operator">&lt;</span>NUM<span class="token punctuation">;</span> j<span class="token operator">++</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token keyword">if</span><span class="token punctuation">(</span><span class="token function">strcmp</span><span class="token punctuation">(</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">,</span>find<span class="token punctuation">)</span> <span class="token operator">==</span> <span class="token number">0</span><span class="token punctuation">)</span>
        <span class="token punctuation">&#123;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\n\n\n\t\t\t=============================================================\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   1.修改员工号                   2.修改姓名             ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   3.修改性别                     4.修改担任职务         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   5.修改年龄                     6.修改员工工资         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||   7.修改员工家庭住址             8.修改员工联系方式     ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t||                                                         ||\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"\t\t\t=============================================================\n"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            p <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span> <span class="token operator">*</span><span class="token punctuation">)</span><span class="token function">malloc</span><span class="token punctuation">(</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
            p<span class="token operator">=</span>workers<span class="token punctuation">;</span>
            <span class="token keyword">int</span> n<span class="token punctuation">;</span>
            <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%d"</span><span class="token punctuation">,</span><span class="token operator">&amp;</span>n<span class="token punctuation">)</span><span class="token punctuation">;</span>
            <span class="token keyword">switch</span> <span class="token punctuation">(</span>n<span class="token punctuation">)</span>
            <span class="token punctuation">&#123;</span>
            <span class="token keyword">case</span> <span class="token number">1</span><span class="token operator">:</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入员工号:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>jobNo<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">case</span> <span class="token number">2</span><span class="token operator">:</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入姓名:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">case</span> <span class="token number">3</span><span class="token operator">:</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入性别:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>sex<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">case</span> <span class="token number">4</span><span class="token operator">:</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入所担任职务:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span> read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>position<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">case</span> <span class="token number">5</span><span class="token operator">:</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入年龄："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>year<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">case</span> <span class="token number">6</span><span class="token operator">:</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入工资:"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>salary<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">case</span> <span class="token number">7</span><span class="token operator">:</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入家庭住址："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>addr<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token keyword">case</span> <span class="token number">8</span><span class="token operator">:</span>
                <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"请输入员工联系方式："</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token function">scanf</span><span class="token punctuation">(</span><span class="token string">"%s"</span><span class="token punctuation">,</span>read<span class="token punctuation">[</span>j<span class="token punctuation">]</span><span class="token punctuation">.</span>tel<span class="token punctuation">)</span><span class="token punctuation">;</span>
                <span class="token keyword">break</span><span class="token punctuation">;</span>
            <span class="token punctuation">&#125;</span>
        <span class="token punctuation">&#125;</span>
    <span class="token punctuation">&#125;</span>
<span class="token comment">//以全部重新输入的形式去替换原本数据，达到修改的目的；</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    fp<span class="token operator">=</span><span class="token function">fopen</span><span class="token punctuation">(</span><span class="token string">"text.dat"</span><span class="token punctuation">,</span><span class="token string">"wb+"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">fwrite</span><span class="token punctuation">(</span>read<span class="token punctuation">,</span><span class="token keyword">sizeof</span><span class="token punctuation">(</span><span class="token keyword">struct</span> <span class="token class-name">workers</span><span class="token punctuation">)</span><span class="token punctuation">,</span>NUM<span class="token punctuation">,</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>fp<span class="token operator">==</span><span class="token constant">NULL</span><span class="token punctuation">)</span>
    <span class="token punctuation">&#123;</span>
        <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"文件修改失败"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
        <span class="token function">exit</span><span class="token punctuation">(</span>EXIT_FAILURE<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">&#125;</span>
    <span class="token function">printf</span><span class="token punctuation">(</span><span class="token string">"修改成功！"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">fclose</span><span class="token punctuation">(</span>fp<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"pause"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">system</span><span class="token punctuation">(</span><span class="token string">"cls"</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token function">Hollow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token comment">//最后返回操作界面；</span>
<span class="token punctuation">&#125;</span>
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>####&nbsp;&nbsp;&nbsp;3.1.3main.c</p>
<pre class="line-numbers language-none"><code class="language-none">#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include&quot;gongshi.h&quot;
int main()
&#123;
    smile() ;
    struct workers *workers;
    workers &#x3D; (struct workers*)malloc(sizeof(struct workers));
    int flag_1;
    int n;
    flag_1&#x3D;sign();
    see();
    if(flag_1&#x3D;&#x3D;2)
    &#123;
        system(&quot;cls&quot;);
        Hollow();
        while (1)
        &#123;
            scanf(&quot;%d&quot;,&amp;n);
            if(n&#x3D;&#x3D;1)
                f_1(workers);
            else if(n&#x3D;&#x3D;2)
                f_2(workers);
            else if(n&#x3D;&#x3D;3)
            &#123;
                int n;
                system(&quot;cls&quot;);
                printf(&quot;请输入查询方式             1.   员工号查询         2.姓名查询\n&quot;);
                scanf(&quot;%d&quot;,&amp;n);
                if (n&#x3D;&#x3D;1)f_3_1(workers);
                else if (n&#x3D;&#x3D;2)f_3_2(workers);
            &#125;

            else if(n&#x3D;&#x3D;4)
                f_4(workers);
            else if(n&#x3D;&#x3D;5)
                f_5(workers);
            else if(n&#x3D;&#x3D;6)
            &#123;
                f_6(n);
                break;
            &#125;
            else
            &#123;
                int n;
                system(&quot;cls&quot;);
                printf(&quot;请输入正确的功能编号!\n&quot;);
                system(&quot;pause&quot;);
                system(&quot;cls&quot;);
                Hollow();
            &#125;
        &#125;
    &#125;
&#125;
<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h4 id="3-2分函数讲解"><a href="#3-2分函数讲解" class="headerlink" title="3.2分函数讲解"></a>3.2分函数讲解</h4><h6 id="3-2-1登录过场动画"><a href="#3-2-1登录过场动画" class="headerlink" title="3.2.1登录过场动画"></a>3.2.1登录过场动画</h6><pre class="line-numbers language-none"><code class="language-none">void smile()
&#x2F;&#x2F;1、系统加载界面
&#123;
    int i;
    printf(&quot;\n\n\n\n&quot;);
    printf(&quot;\t\t\t\t\t系统加载中\n&quot;);
    printf(&quot;\t\t\t&quot;);
    for(i &#x3D; 0; i &lt;20; i++)
    &#123;
        printf(&quot;$ &quot;);
        if(i &#x3D;&#x3D;19)
            printf(&quot;\n&quot;);
        Sleep(100);
        &#x2F;&#x2F;使计算机进入短暂的休眠状态100毫秒
    &#125;
    system(&quot;cls&quot;);
    printf(&quot;\n\n\n\n&quot;);
    printf(&quot;\t\t\t\t\t系统加载完成！\n&quot;);
    printf(&quot;\t\t\t\t\t  欢迎使用！\n&quot;);
    Sleep(500);
    system(&quot;cls&quot;);&#x2F;&#x2F;执行清屏操作
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;一个负责整活的过场动画，对于整个系统来说可有可无，但是可以丰富整个程序，避免这个程序过于简陋。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 for循环和sleep（）函数搭配使用，每隔0.1秒输出一个$,做到登录动画；<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 system(“cls”)函数清屏，输出系统加载完成，欢迎使用。</p>
<h6 id="3-2-2辅助文件读取函数（）"><a href="#3-2-2辅助文件读取函数（）" class="headerlink" title="3.2.2辅助文件读取函数（）"></a>3.2.2辅助文件读取函数（）</h6><pre class="line-numbers language-none"><code class="language-none">void see (void)
&#x2F;&#x2F;该函数是从辅助文件中读取员工个数；
&#123;
    FILE *fp1;
    char ch[10];
    fp1&#x3D;fopen(&quot;data.txt&quot;,&quot;r+&quot;);
    &#x2F;&#x2F;data.txt为辅助的文本文件；
    if (fp1&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;人数预存文件打开失败&quot;);
        exit(EXIT_FAILURE);
    &#125;
    fgets(ch,3,fp1);
    NUM&#x3D;atoi(ch);
    fclose(fp1);
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 我使用了名为<strong>data.txt</strong>的文本文件进行辅助，在运行这个文件时需要有一个函数读取文件中的数据。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 使用fets（）函数以字符串的形式将数据从文本文件中读取出来，此时从文本文件中读取出来的是字符串，这里我们就用到一个atoi（）函数将字符串转化为整形数。</p>
<blockquote>
<p>其实这个地方用格式化读取<strong>fscanf（fp，“%d”，&amp;NUM）；</strong>完全可以做到，作者使用的方式完全多此一举，但考虑到实训要有和其他组不同的特色，故采取了这种下策，并不建议模仿。</p>
</blockquote>
<h6 id="3-2-3登录页面"><a href="#3-2-3登录页面" class="headerlink" title="3.2.3登录页面"></a>3.2.3登录页面</h6><pre class="line-numbers language-none"><code class="language-none">int sign(void)
&#123;
    int n;
    struct workers *workers;

    workers &#x3D; (struct workers*)malloc(sizeof(struct workers));

    printf(&quot;\t\t\t&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;\n&quot;);
    printf(&quot;\t\t\t||                  《职工信息管理系统》                   ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                 请按相应按键使用本系统！                ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||   1.员工登录                       2.管理员模式         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;\n&quot;);
    scanf(&quot;%d&quot;,&amp;n);
    char number[9];
    char pow[10];
    if(n&#x3D;&#x3D;2)
    &#123;
        printf(&quot;请输入管理员账号&quot;);
        scanf(&quot;%s&quot;,number);
        fflush(stdin);
        printf(&quot;请输入密码&quot;);
        &#123;
            for(int i&#x3D;0; i&lt;9; i++)
            &#123;
                pow[i] &#x3D; getch();
                &#x2F;*逐次赋值,但不回显*&#x2F;
                if (pow[i] &#x3D;&#x3D; &#39;\x0d&#39;)
                    &#x2F;*回车则终止循环*&#x2F;
                &#123;
                    pow[i]&#x3D;&#39;\0&#39;;
                    break;
                &#125;
                printf(&quot;*&quot;);       &#x2F;*以星号代替字符个数*&#x2F;
            &#125;
            fflush(stdin);
            if((strcmp(number,&quot;0001&quot;)&#x3D;&#x3D;0) &amp;&amp; (strcmp(pow,&quot;123456&quot;)&#x3D;&#x3D;0))
            &#123;
                return n;
            &#125;
            else
                printf(&quot;账号或密码错误!&quot;);
        &#125;
    &#125;
    else if(n&#x3D;&#x3D;1)
    &#123;
        f_3 (workers);
        return n;
    &#125;
    else
    &#123;
        int n;
        system(&quot;cls&quot;);
        printf(&quot;请输入正确的功能编号!\n&quot;);
        system(&quot;pause&quot;);
        system(&quot;cls&quot;);
        sign();
    &#125;
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p><strong>此处是登录页面</strong><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 回显实际上存在问题，如果在输入过程中输入错误，想要把已经输入的数据删除的话，是无法完成的，因为使用的是<strong>getchar（）</strong>，<em>delete</em>实际上也是一种字符，这里是一个隐患。由于影响并不严重，不会影响到我的演示，就没有对这个问题进行修复。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 管理员账号设置后无法更改，这点有点反人类，做出更改实际不难，但是这次实训三人小组实际上就我一个人负责，我真的不想再给自己找活干了。</p>
<h6 id="3-2-4操作页面"><a href="#3-2-4操作页面" class="headerlink" title="3.2.4操作页面"></a>3.2.4操作页面</h6><pre class="line-numbers language-none"><code class="language-none">int Hollow(void)
&#x2F;&#x2F;管理员页面，在程序中会反复调用；
&#123;
    system(&quot;cls&quot;);
    printf(&quot;\n\n\n\t\t\t&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                   《职工信息管理系统》                  ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                       管理员页面！                      ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||   1.新建职工信息                 2.浏览职工信息         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||   3.查询职工信息                 4.删除职工信息         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||   5.变更职工信息                 6.退出程序             ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;\n&quot;);
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<center> 单纯的一个操作页面 </center>
###### 3.2.5新建职工信息
<pre class="line-numbers language-none"><code class="language-none">void f_1(struct workers *workers)
&#x2F;&#x2F;以尾加法插入新的数据，并写入text.dat二进制文件中；
&#123;
    struct workers *p;
    &#x2F;&#x2F;p是个指向结构体指针后面需要用到；
    p &#x3D; (struct workers *)malloc(sizeof(struct workers));
    &#x2F;&#x2F;对指针p分配大小；
    p&#x3D;workers;
    printf(&quot;请输入员工号:&quot;);
    scanf(&quot;%s&quot;, p-&gt;jobNo);
    printf(&quot;请输入姓名:&quot;);
    scanf(&quot;%s&quot;, p-&gt;name);
    printf(&quot;请输入性别:&quot;);
    scanf(&quot;%s&quot;, p-&gt;sex);
    printf(&quot;请输入所担任职务:&quot;);
    scanf(&quot;%s&quot;, p-&gt;position);
    printf(&quot;请输入年龄：&quot;);
    scanf(&quot;%s&quot;,p-&gt;year);
    printf(&quot;请输入工资:&quot;);
    scanf(&quot;%s&quot;, p-&gt;salary);
    printf(&quot;请输入家庭住址：&quot;);
    scanf(&quot;%s&quot;, p-&gt;addr);
    printf(&quot;请输入员工联系方式：&quot;);
    scanf(&quot;%s&quot;, p-&gt;tel);
    FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;ab+&quot;);
    if (fp&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;文件打开失败&quot;);
        exit(EXIT_FAILURE);
        &#x2F;&#x2F;这段程序是结束函数块的，如果没有这段代码后面内容还会继续输出。
    &#125;
    fwrite(workers,sizeof(struct workers),1,fp);
    &#x2F;&#x2F;将数据存入函数中；
    fclose(fp);
    char ch[10];
    NUM++;
    sprintf(ch,&quot;%d&quot;,&amp;NUM);
    FILE *fp1;
    fp1&#x3D;fopen(&quot;data.txt&quot;,&quot;w+&quot;);
    itoa(NUM,ch, 10);
    &#x2F;&#x2F;一个没学过的函数，把整形数转化成字符型；
    fputs(ch,fp1);
    fclose(fp1);
    system(&quot;cls&quot;);
    &#x2F;*
    使用外部变量NUM，在使用者使用程序时先行为，NUM赋值；
    *&#x2F;
    Hollow();
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
实现增添的一个程序块，主要功能**以追加的形式将数据存入二进制文件，并且将从文本文件中读取的NUM值自增，并将NUM重新存入文本文件中。**
解释说明：
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 由于每个程序块没有返回值的需要，函数就使用了没有返回值的void类型
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2  **FILE** * **fp=fopen("text.dat","ab+");**以追加方式打开text.dat这个二进制文件 ，再使用**fwrite(workers,sizeof(struct workers),1,fp);**语句将一个大小为sizeof(struct workers)的结构体变量workers写入二进制文件中。
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3 我在这里使用了itoa（）这个函数,函数原型为
> char *itoa( int value, char *string,int radix)
***value***：欲转换的数据。
***string***：目标字符串的地址。
***radix***： 转换后的进制数，可以是10进制、16进制等。
同刚刚使用的atoi函数itoa函数也可以用格式化写函数fprintf（）解决，终究还是多此一举了。

<h5 id="3-2-6浏览（筛选）职工信息："><a href="#3-2-6浏览（筛选）职工信息：" class="headerlink" title="3.2.6浏览（筛选）职工信息："></a>3.2.6浏览（筛选）职工信息：</h5><pre class="line-numbers language-none"><code class="language-none">void f_2(struct workers *workers)
&#x2F;&#x2F;浏览已经写入的数据；
&#123;
    system(&quot;cls&quot;);
    printf(&quot;\n\n\n\t\t\t&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||   1.浏览全部信息                 2.按性别方式筛选       ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||   3.按年龄方式筛选               4.按薪资筛选           ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t||                                                         ||\n&quot;);
    printf(&quot;\t\t\t&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;\n&quot;);
    int n;
    printf(&quot;请输入筛选的方式\n&quot;);
    scanf(&quot;%d&quot;,&amp;n);
    if(n&#x3D;&#x3D;1)
    &#123;
        system(&quot;cls&quot;);
        struct workers read[100],*p;
        FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb+&quot;);

        if (fp&#x3D;&#x3D;NULL)
        &#123;
            printf(&quot;文件打开失败&quot;);
            exit(EXIT_FAILURE);
        &#125;
        fread(read,sizeof(struct workers),100,fp);
        int i;
        for (i&#x3D;0; i&lt;NUM; i++)
        &#123;
            p&#x3D;&amp;read[i];
            if(read[i].jobNo)
            &#123;
                printf(&quot;——————————————————————————————\n&quot;);
                printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
                printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
                printf(&quot;—————————————————————————————\n&quot;);
            &#125;
        &#125;
        system(&quot;pause&quot;);
        system(&quot;cls&quot;);
        Hollow();
    &#125;
    else if(n&#x3D;&#x3D;2)
    &#123;
        int k;
        system(&quot;cls&quot;);
        printf(&quot;请输入要筛选的员工性别编号\n&quot;);
        printf(&quot;1.男性    \t\t     2.女性\n&quot;);
        scanf(&quot;%d&quot;,&amp;k);
        struct workers read[100],*p;
        FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb+&quot;);

        if (fp&#x3D;&#x3D;NULL)
        &#123;
            printf(&quot;文件打开失败&quot;);
            exit(EXIT_FAILURE);
        &#125;
        fread(read,sizeof(struct workers),100,fp);
        if (k&#x3D;&#x3D;1)
        &#123;
            int i;
            for (i&#x3D;0; i&lt;NUM; i++)
            &#123;
                p&#x3D;&amp;read[i];
                if(strcmp(read[i].sex,&quot;男&quot;)&#x3D;&#x3D;0)
                &#123;
                    printf(&quot;——————————————————————————————\n&quot;);
                    printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
                    printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
                    printf(&quot;—————————————————————————————\n&quot;);
                &#125;
            &#125;
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;
        else if (k&#x3D;&#x3D;2)
        &#123;
            int i;
            for (i&#x3D;0; i&lt;NUM; i++)
            &#123;
                p&#x3D;&amp;read[i];
                if(strcmp(read[i].sex,&quot;女&quot;)&#x3D;&#x3D;0)
                &#123;
                    printf(&quot;——————————————————————————————\n&quot;);
                    printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
                    printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
                    printf(&quot;—————————————————————————————\n&quot;);
                &#125;
            &#125;
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;
        else
        &#123;
            printf(&quot;你好像想查询什么奇奇怪怪的东西！\n&quot;);
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;

    &#125;
    else if(n&#x3D;&#x3D;3)
    &#123;
        int k;
        system(&quot;cls&quot;);
        printf(&quot;请输入要筛选的员工薪资范围\n&quot;);
        printf(&quot;1.青年    \t\t     2.壮年\n&quot;);
        scanf(&quot;%d&quot;,&amp;k);
        struct workers read[100],*p;
        FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb+&quot;);

        if (fp&#x3D;&#x3D;NULL)
        &#123;
            printf(&quot;文件打开失败&quot;);
            exit(EXIT_FAILURE);
        &#125;
        fread(read,sizeof(struct workers),100,fp);
        if (k&#x3D;&#x3D;1)
        &#123;
            int i;
            for (i&#x3D;0; i&lt;NUM; i++)
            &#123;
                p&#x3D;&amp;read[i];

                if(atoi(read[i].year)&lt;30)
                &#123;
                    printf(&quot;——————————————————————————————\n&quot;);
                    printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
                    printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
                    printf(&quot;—————————————————————————————\n&quot;);
                &#125;
            &#125;
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();

        &#125;
        else if (k&#x3D;&#x3D;2)
        &#123;
            int i;
            for (i&#x3D;0; i&lt;NUM; i++)
            &#123;
                p&#x3D;&amp;read[i];
                if(atoi(read[i].year)&gt;30)
                &#123;
                    printf(&quot;——————————————————————————————\n&quot;);
                    printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
                    printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
                    printf(&quot;—————————————————————————————\n&quot;);
                &#125;
            &#125;
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;
        else
        &#123;
            printf(&quot;你好像想查询什么奇奇怪怪的东西！\n&quot;);
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;
    &#125;
    else if(n&#x3D;&#x3D;4)
    &#123;
        int k;
        system(&quot;cls&quot;);
        printf(&quot;请输入要筛选的员工薪资范围\n&quot;);
        printf(&quot;1.低薪    \t\t     2.中薪\t\t\t  3.高薪\n&quot;);
        scanf(&quot;%d&quot;,&amp;k);
        struct workers read[100],*p;
        FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb+&quot;);
        if (fp&#x3D;&#x3D;NULL)
        &#123;
            printf(&quot;文件打开失败&quot;);
            exit(EXIT_FAILURE);
        &#125;
        fread(read,sizeof(struct workers),100,fp);
        if (k&#x3D;&#x3D;1)
        &#123;
            int i;
            for (i&#x3D;0; i&lt;NUM; i++)
            &#123;
                p&#x3D;&amp;read[i];
                if(atoi(read[i].salary)&lt;3000)
                &#123;
                    printf(&quot;——————————————————————————————\n&quot;);
                    printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
                    printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
                    printf(&quot;—————————————————————————————\n&quot;);
                &#125;
            &#125;
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;
        else if (k&#x3D;&#x3D;2)
        &#123;
            int i;
            for (i&#x3D;0; i&lt;NUM; i++)
            &#123;
                p&#x3D;&amp;read[i];
                if(atoi(read[i].salary)&gt;&#x3D;3000&amp;&amp;atoi(read[i].salary)&lt;8000)
                &#123;
                    printf(&quot;——————————————————————————————\n&quot;);
                    printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
                    printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
                    printf(&quot;—————————————————————————————\n&quot;);
                &#125;
            &#125;
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;
        else if(k&#x3D;&#x3D;3)
        &#123;
            int i;
            for (i&#x3D;0; i&lt;NUM; i++)
            &#123;
                p&#x3D;&amp;read[i];

                if(atoi(read[i].salary)&gt;&#x3D;8000)
                &#123;
                    printf(&quot;——————————————————————————————\n&quot;);
                    printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
                    printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
                    printf(&quot;—————————————————————————————\n&quot;);
                &#125;
            &#125;
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;
        else
        &#123;
            printf(&quot;你好像想查询什么奇奇怪怪的东西！\n&quot;);
            system(&quot;pause&quot;);
            system(&quot;cls&quot;);
            Hollow();
        &#125;
    &#125;
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>这一模块一开始计划是只是浏览全部的员工信息，在后期的实训过程中，想到一个公司经常会有各种活动，需要对参与员工进行筛选，对其追加了根据年龄，工资与性别的筛选功能。<br>解释说明：<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1  浏览只需要将全部数据从二进制文件中读取到结构体，通过for循环将所有的数据输出到屏幕中。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 关于筛选其实可以做的更好，比如说以年龄方式筛选的时候可以让使用者自己输入筛选的年龄范围，而不是我自己预先设定好的青年，壮年。同样按工资进行查询时同样也可以让使用者设置自己的筛选范围，这样可能对使用者更加友好。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;3 第三点我曾经试图做出复合的筛选程序，只是感觉会过于复杂就没有做，大体的思路和现在一样，但是同时选择多种筛选方式，并对二进制文件中的数据进行复合筛选，找到需要的数据。</p>
<h5 id="3-2-7查找职工信息："><a href="#3-2-7查找职工信息：" class="headerlink" title="3.2.7查找职工信息："></a>3.2.7查找职工信息：</h5><pre class="line-numbers language-none"><code class="language-none">void f_3_1(struct workers *n)
&#x2F;&#x2F;以员工号方式查询某个员工的信息。
&#123;
    system(&quot;cls&quot;);
    struct workers read[100],*p;
    FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb+&quot;);a
    if (fp&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;文件打开失败&quot;);
        exit(EXIT_FAILURE);
    &#125;
    fread(read,sizeof(struct workers),100,fp);
    char found[100];
    fclose(fp);
    printf(&quot;\n请输入你要查询的职工的职工号：&quot;);
    scanf(&quot;%s&quot;, found);
    int i;
    for (i&#x3D;0; i&lt;100; i++)
    &#123;
        p&#x3D;&amp;read[i];
        if(strcmp(read[i].jobNo,found)&#x3D;&#x3D;0)
        &#123;
            printf(&quot;——————————————————————————————\n&quot;);
            printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
            printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
            printf(&quot;—————————————————————————————\n&quot;);
            break;
        &#125;
    &#125;
    if (i&#x3D;&#x3D;100)
    &#123;
        printf(&quot;没有该员工！&quot;);
    &#125;
    system(&quot;pause&quot;);
    system(&quot;cls&quot;);
    Hollow();
&#125;
void f_3(struct workers *n)
&#x2F;&#x2F;以员工号方式查询某个员工的信息。
&#123;
    system(&quot;cls&quot;);
    struct workers read[100],*p;
    FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb+&quot;);
    if (fp&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;文件打开失败&quot;);
        exit(EXIT_FAILURE);
    &#125;
    fread(read,sizeof(struct workers),100,fp);
    char found[100];
    fclose(fp);
    printf(&quot;\n请输入你要查询的职工的职工号：&quot;);
    scanf(&quot;%s&quot;, found);
    int i;
    for (i&#x3D;0; i&lt;100; i++)
    &#123;
        p&#x3D;&amp;read[i];
        if(strcmp(read[i].jobNo,found)&#x3D;&#x3D;0)
        &#123;
            printf(&quot;——————————————————————————————\n&quot;);
            printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
            printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
            printf(&quot;—————————————————————————————\n&quot;);
            break;
        &#125;
    &#125;
    if (i&#x3D;&#x3D;100)
    &#123;
        printf(&quot;没有该员工！&quot;);
    &#125;
    system(&quot;pause&quot;);
    system(&quot;cls&quot;);
&#125;
void f_3_2(struct workers *n)
&#123;
    &#x2F;&#x2F;以姓名方式查找员工；
    system(&quot;cls&quot;);
    struct workers read[100],*p;
    FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb+&quot;);

    if (fp&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;文件打开失败&quot;);
        exit(EXIT_FAILURE);
    &#125;
    fread(read,sizeof(struct workers),100,fp);
    char found[100];
    fclose(fp);
    printf(&quot;\n请输入你要查询的职工的姓名：&quot;);
    scanf(&quot;%s&quot;, found);
    int i;
    for (i&#x3D;0; i&lt;100; i++)
    &#123;
        p&#x3D;&amp;read[i];
        if(strcmp(read[i].name,found)&#x3D;&#x3D;0)
            &#x2F;&#x2F;用found数组进行比较如果found数组和name相同则执行；
        &#123;
            printf(&quot;——————————————————————————————\n&quot;);
            printf(&quot;|职工号|姓名  |性别|年龄|职务      |工资  |住址    |电话       |\n&quot;);
            printf(&quot;|%-6s|%-6s|%-4s|%-4s|%-10s|%-6s|%-8s|%-11s|\n &quot;,p-&gt;jobNo, p-&gt;name, p-&gt;sex, p-&gt;year,p-&gt;position, p-&gt;salary, p-&gt;addr, p-&gt;tel);
            printf(&quot;—————————————————————————————\n&quot;);
            break;
        &#125;
    &#125;
    if (i&#x3D;&#x3D;100)
        &#x2F;&#x2F;当
    &#123;
        printf(&quot;没有该员工！&quot;);
    &#125;
    system(&quot;pause&quot;);
    system(&quot;cls&quot;);
    Hollow();
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>该模块对员工信息的查询功能包括两个方面，按员工号对员工信息进行查询和按照姓名方式进行查询，如果查询失败则输出没有该员工，返回操作页面。反之查询成功，输出查询到的数据。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 这一块代码主要利用<strong>strcmp（）函数</strong>比较输入的员工号或者员工姓名与从二进制文件中读取到结构体块中的数据对比，如果strcmp返回值为0则查询成功。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 这部分代码也有改进的地方由于各种原因没有实现。</p>
<h5 id="3-2-8删除员工信息"><a href="#3-2-8删除员工信息" class="headerlink" title="3.2.8删除员工信息"></a>3.2.8删除员工信息</h5><pre class="line-numbers language-none"><code class="language-none">int f_4(struct workers *workers)
&#x2F;&#x2F;删除数据；
&#123;
    struct workers *p;
    int j;
    struct workers read[100];
    char find[10];
    FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb&quot;);
    if (fp&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;文件打开失败&quot;);
        exit(EXIT_FAILURE);
    &#125;
    fread(read,sizeof(struct workers),NUM,fp);
    printf(&quot;请输入要删除的职工号&quot;);
    scanf(&quot;%s&quot;,find);
    for(j&#x3D;0; j&lt;&#x3D;NUM; j++)
    &#123;
        if(strcmp(read[j].jobNo,find) &#x3D;&#x3D; 0)
        &#123;
            NUM--;
            &#x2F;&#x2F;将num--这个操作，更改变量的大小，方便再次存入。
            break;
        &#125;
    &#125;
    if(NUM&lt;j)
        &#x2F;&#x2F;如果没有提前结束，j的最终大小回是num+1;判断num是否及时结束。
    &#123;
        printf(&quot;该职工号不存在！&quot;);
        system(&quot;pause&quot;);
    &#125;
    if(strcmp(read[j].jobNo,find) &#x3D;&#x3D; 0)
    &#123;
        for(j; j&lt;NUM; j++)
        &#123;
            strcpy(read[j].jobNo,read[j+1].jobNo);
            strcpy(read[j].name,read[j+1].name);
            strcpy(read[j].sex,read[j+1].sex);
            strcpy(read[j].position,read[j+1].position);
            strcpy(read[j].year,read[j+1].year);
            strcpy(read[j].salary,read[j+1].salary);
            strcpy(read[j].addr,read[j+1].addr);
            strcpy(read[j].tel,read[j+1].tel);
        &#125;
    &#125;
&#x2F;&#x2F;将read[j]进行移位，达到删除的目的；
    fclose(fp);
&#x2F;&#x2F;关闭文件
    char ch[10];
    &#x2F;&#x2F;定义一个
    fp&#x3D;fopen(&quot;text.dat&quot;,&quot;wb+&quot;);
    if (fp&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;删除失败！&quot;);
        exit(EXIT_FAILURE);
    &#125;
    fwrite(read,sizeof(struct workers),NUM,fp);
    fclose(fp);
    FILE *fp1;
    fp1&#x3D;fopen(&quot;data.txt&quot;,&quot;w+&quot;);
    &#x2F;&#x2F;使用一个txt格式的文件作为辅助，进行数据量的计数。
    itoa(NUM,ch, 10);
    &#x2F;&#x2F;一个没学过的函数，把整形数转化成字符型；
    fputs(ch,fp1);
    fclose(fp1);
    system(&quot;cls&quot;);
    system(&quot;pause&quot;);
    system(&quot;cls&quot;);
    Hollow();
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>从二进制文件中将数据全部读取出来，将输入的员工号与已有数据中的员工号进行比对，当数据相同时删除该员工信息，并将全部信息重新写入文件中。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;1 这一块程序是我做出来感觉遗憾最大的一块，在C语言实训最后的答辩中，我看到很多同学在删除这一块下足了功夫，我看到有的同学在删除前增加了是否删除的验证程序，也有的同学在这一块追加了密码输入，以验证执行删除功能的是否是管理员本人。<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;2 如果有时间，可以尝试增加一个撤销删除的功能，这个功能之前想过，可以令设一个结构体变量暂时存储删除的数据，如果执行撤销删除程序是，则把暂存结构体中的数据写入二进制文件中。<br>#####3.2.9修改员工信息</p>
<pre class="line-numbers language-none"><code class="language-none">void f_5(struct workers *workers)
&#x2F;&#x2F;在文件中读取数据，对数据进行修改，最后在存入文件中。
&#123;
    struct workers *p;
    int j;
    struct workers read[NUM];
    char find[10];
    FILE *fp&#x3D;fopen(&quot;text.dat&quot;,&quot;rb&quot;);
    if (fp&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;文件打开失败&quot;);
        exit(EXIT_FAILURE);
    &#125;
    fread(read,sizeof(struct workers),NUM,fp);
    printf(&quot;请输入要修改的职工号&quot;);
    scanf(&quot;%s&quot;,find);
    system(&quot;cls&quot;);
    for(j&#x3D;0; j&lt;NUM; j++)
    &#123;
        if(strcmp(read[j].jobNo,find) &#x3D;&#x3D; 0)
        &#123;
            printf(&quot;\n\n\n\t\t\t&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;\n&quot;);
            printf(&quot;\t\t\t||                                                         ||\n&quot;);
            printf(&quot;\t\t\t||                                                         ||\n&quot;);
            printf(&quot;\t\t\t||                                                         ||\n&quot;);
            printf(&quot;\t\t\t||   1.修改员工号                   2.修改姓名             ||\n&quot;);
            printf(&quot;\t\t\t||                                                         ||\n&quot;);
            printf(&quot;\t\t\t||   3.修改性别                     4.修改担任职务         ||\n&quot;);
            printf(&quot;\t\t\t||                                                         ||\n&quot;);
            printf(&quot;\t\t\t||   5.修改年龄                     6.修改员工工资         ||\n&quot;);
            printf(&quot;\t\t\t||                                                         ||\n&quot;);
            printf(&quot;\t\t\t||   7.修改员工家庭住址             8.修改员工联系方式     ||\n&quot;);
            printf(&quot;\t\t\t||                                                         ||\n&quot;);
            printf(&quot;\t\t\t&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;&#x3D;\n&quot;);
            p &#x3D; (struct workers *)malloc(sizeof(struct workers));
            p&#x3D;workers;
            int n;
            scanf(&quot;%d&quot;,&amp;n);
            switch (n)
            &#123;
            case 1:
                printf(&quot;请输入员工号:&quot;);
                scanf(&quot;%s&quot;, read[j].jobNo);
                break;
            case 2:
                printf(&quot;请输入姓名:&quot;);
                scanf(&quot;%s&quot;,read[j].name);
                break;
            case 3:
                printf(&quot;请输入性别:&quot;);
                scanf(&quot;%s&quot;, read[j].sex);
                break;
            case 4:
                printf(&quot;请输入所担任职务:&quot;);
                scanf(&quot;%s&quot;, read[j].position);
                break;
            case 5:
                printf(&quot;请输入年龄：&quot;);
                scanf(&quot;%s&quot;,read[j].year);
                break;
            case 6:
                printf(&quot;请输入工资:&quot;);
                scanf(&quot;%s&quot;,read[j].salary);
                break;
            case 7:
                printf(&quot;请输入家庭住址：&quot;);
                scanf(&quot;%s&quot;,read[j].addr);
                break;
            case 8:
                printf(&quot;请输入员工联系方式：&quot;);
                scanf(&quot;%s&quot;,read[j].tel);
                break;
            &#125;
        &#125;
    &#125;
&#x2F;&#x2F;以全部重新输入的形式去替换原本数据，达到修改的目的；
    fclose(fp);
    fp&#x3D;fopen(&quot;text.dat&quot;,&quot;wb+&quot;);
    fwrite(read,sizeof(struct workers),NUM,fp);
    if (fp&#x3D;&#x3D;NULL)
    &#123;
        printf(&quot;文件修改失败&quot;);
        exit(EXIT_FAILURE);
    &#125;
    printf(&quot;修改成功！&quot;);
    fclose(fp);
    system(&quot;pause&quot;);
    system(&quot;cls&quot;);
    Hollow();
&#x2F;&#x2F;最后返回操作界面；
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<p>该模块具体执行数据的修改，分成八个部分修改员工的各种信息。</p>
<h5 id="3-2-10退出程序"><a href="#3-2-10退出程序" class="headerlink" title="3.2.10退出程序"></a>3.2.10退出程序</h5><pre class="line-numbers language-none"><code class="language-none">int f_6(char n)
&#x2F;&#x2F;退出程序；
&#123;
    printf(&quot;感谢您使用本系统，祝您工作愉快\n&quot;);
    system(&quot;pause&quot;);
    system(&quot;cls&quot;);
    return 0;
&#125;<span aria-hidden="true" class="line-numbers-rows"><span></span><span></span><span></span><span></span><span></span><span></span><span></span><span></span></span></code></pre>
<h2 id="4-漏洞分析与修复"><a href="#4-漏洞分析与修复" class="headerlink" title="4.漏洞分析与修复"></a>4.漏洞分析与修复</h2><p>在整个C语言实训中，我不断的制造大大小小的bug，同时也在不断的修复这些bug，以下是我在这个C语言实训中遇到的一些问题。<br>1.起初我对删除文件信息的设计存在无法修复的缺陷，起初的设想是用空格字符串去换结构体数组中的每一项字符串，但做出来，再次浏览时发现位置被空格字符串占据，尝试修改这个被空格占据的结构体，发现无法继续对该位置进行操作，最终决定放弃该思路。<br>2.在浏览全部数据时难以判断存入数据多少；在老师的指导下采用了一个txt文件作为辅助，这一点极其关键，我的这串代码如果缺少了作为辅助的文本文件data.txt实际上是无法运行的，但同时我的程序中也没有代码块，包含对该辅助文件的创建，只有对改文件进行更新，意味着使用改系统，必须手动创建一个文本文件data.txt<br>3.文本文件的读写，将文本文件的信息读入程序时发现存在问题，在文本文件中是以字符型的一个个数字，而在程序中使用我需要的是一个整形数，最后百度找到了一个函数atoi就这个将字符型数转化成整形<br>4.同上一个问题在写入时也有这个问题，然后就找到了一个函数将int类型转化成char数组。<br>5.在添加员工的过程中，一开始使用了wb+却没注意到，发现数据一直存不进去。之后看到打开方式，改成ab+就没问题了。<br>6.在员工登录，执行完查询程序后，意外弹出了管理员的页面，检查程序发现是起初按管理员模式写的操作页面被镶嵌到每一个功能块的最后，而员工直接调用管理员的查询函数照成了该故障，故重写了一个更改过的查询函数，用在员工页面。<br>7.在使用工程解决的时候因为对文件引用不太了解出现了一堆问题，修复了半天。<br>8.其实在查询的时候那个格式真的很难弄，一开始的思路存在问题，起初是根据第一个存入的数据大小更改页面的大小，但是发现只要输入的数据发生改变，就会导致格式不在规范，最后则是由%nd的形式规范</p>
<h2 id="5-总结反思"><a href="#5-总结反思" class="headerlink" title="5.总结反思"></a>5.总结反思</h2><p>由于我们的C语言的实训，由于开课比较早，专业课没有结束，做项目需要的结构体的知识和文件调用的知识并没有学，最初做起来也是非常困难，利用互联网去查询如何实现文件调用，去看网络上其他人做到程序，通过种种方式去学习这些内容，对我们组每一位组员的自我学习能力都是一个巨大的提高。<br>另一个体会是规划的重要性，我们一开始程序设计分析的时候对规划做得并不好，很多程序功能都是后面有了构思后补充的，如果会进行下一次的实训，系统的构思一定要做好。<br>    生活中我们习以为常的小问题，我们看似毫无新意的小程序，由我们自己实施起来却困难重重，大家都喜欢开程序员的玩笑，说,你怎么还不秃顶。看似调侃却透露出编程的不易，而属于我们的一切才刚刚开始，实训当然是挺难的，没有接触的函数，细小的失误，复杂的逻辑，但所幸我们成功地站在了这里。我们从中吸取了许多教训，我们对以后的学习和生活有了更多的了解。</p>
<blockquote>
<p>这是最好的时代，这是最坏的时代，我们仍然年轻，我们仍然伫立。——–致所有在座的各位。</p>
</blockquote>
<h2 id="6收获"><a href="#6收获" class="headerlink" title="6收获"></a>6收获</h2><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;实训真的带给我们很多提高，使用的很多函数都是课上没有讲过的，而这里调了一些展示出来</p>
<blockquote>
<p>system(“pause”);暂停函数，避免程序运行跳转太快而无法看清数据。<br>system(“cls”);清屏函数，清楚屏幕上的信息，方便程序展示。<br>atoi（）函数将char类型数转化为int类型的数。<br>itoa（）函数将int类型的变量转化为字符串。<br>Sleep（）函数来自Windows.h中的函数，让程序延迟一段时间，登录系统的动画就是应用了该函数<br>fflush(stdin)函数，清空缓冲器，方便后续的文件读写</p>
</blockquote>
<p>在其他的方面，如小组合作，自我学习能力，从网络上获取知识的能力都得到显著的提高。</p>
<h2 id="7-程序演示"><a href="#7-程序演示" class="headerlink" title="7.程序演示"></a>7.程序演示</h2><h2 id="8-鸣谢"><a href="#8-鸣谢" class="headerlink" title="8.鸣谢"></a>8.鸣谢</h2><p>感谢我们大一的C语言黄老师，及负责我们C语言实训的任老师，及协助我完成实训工作的两位同组同学。</p>

                
            </div>
            <hr/>

            

    <div class="reprint" id="reprint-statement">
        
            <div class="reprint__author">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-user">
                        文章作者:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="/shier_jinghuang/about" rel="external nofollow noreferrer">十二惊惶</a>
                </span>
            </div>
            <div class="reprint__type">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-link">
                        文章链接:
                    </i>
                </span>
                <span class="reprint-info">
                    <a href="https://im-so-scared-2.gitee.io/shier_jinghuang/shier_jinghuang/2021/07/31/C%E8%AF%AD%E8%A8%80%E5%AE%9E%E8%AE%AD%E4%B9%8B%E5%91%98%E5%B7%A5%E4%BF%A1%E6%81%AF%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/">https://im-so-scared-2.gitee.io/shier_jinghuang/shier_jinghuang/2021/07/31/C%E8%AF%AD%E8%A8%80%E5%AE%9E%E8%AE%AD%E4%B9%8B%E5%91%98%E5%B7%A5%E4%BF%A1%E6%81%AF%E7%AE%A1%E7%90%86%E7%B3%BB%E7%BB%9F/</a>
                </span>
            </div>
            <div class="reprint__notice">
                <span class="reprint-meta" style="font-weight: bold;">
                    <i class="fas fa-copyright">
                        版权声明:
                    </i>
                </span>
                <span class="reprint-info">
                    本博客所有文章除特別声明外，均采用
                    <a href="https://creativecommons.org/licenses/by/4.0/deed.zh" rel="external nofollow noreferrer" target="_blank">CC BY 4.0</a>
                    许可协议。转载请注明来源
                    <a href="/shier_jinghuang/about" target="_blank">十二惊惶</a>
                    !
                </span>
            </div>
        
    </div>

    <script async defer>
      document.addEventListener("copy", function (e) {
        let toastHTML = '<span>复制成功，请遵循本文的转载规则</span><button class="btn-flat toast-action" onclick="navToReprintStatement()" style="font-size: smaller">查看</a>';
        M.toast({html: toastHTML})
      });

      function navToReprintStatement() {
        $("html, body").animate({scrollTop: $("#reprint-statement").offset().top - 80}, 800);
      }
    </script>



            <div class="tag_share" style="display: block;">
                <div class="post-meta__tag-list" style="display: inline-block;">
                    
                        <div class="article-tag">
                            
                                <a href="/shier_jinghuang/tags/C/">
                                    <span class="chip bg-color">C</span>
                                </a>
                            
                                <a href="/shier_jinghuang/tags/%E7%A8%8B%E5%BA%8F%E8%AE%BE%E8%AE%A1/">
                                    <span class="chip bg-color">程序设计</span>
                                </a>
                            
                        </div>
                    
                </div>
                <div class="post_share" style="zoom: 80%; width: fit-content; display: inline-block; float: right; margin: -0.15rem 0;">
                    <link rel="stylesheet" type="text/css" href="/shier_jinghuang/libs/share/css/share.min.css">
<div id="article-share">

    
    <div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>
    <script src="/shier_jinghuang/libs/share/js/social-share.min.js"></script>
    

    

</div>

                </div>
            </div>
            
        </div>
    </div>

    

    

    

    

    

    

    

    

    

<article id="prenext-posts" class="prev-next articles">
    <div class="row article-row">
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge left-badge text-color">
                <i class="fas fa-chevron-left"></i>&nbsp;上一篇</div>
            <div class="card">
                <a href="/shier_jinghuang/2021/08/01/BugkuCTF%E8%A7%A3%E9%A2%98%E8%AE%B0%E5%BD%95%E4%B9%8Bmisc/">
                    <div class="card-image">
                        
                        
                        <img src="/shier_jinghuang/medias/featureimages/10.jpg" class="responsive-img" alt="BUGKU靶场解题记录之misc(一)">
                        
                        <span class="card-title">BUGKU靶场解题记录之misc(一)</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                        <span class="publish-date">
                            <i class="far fa-clock fa-fw icon-date"></i>2021-08-01
                        </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/shier_jinghuang/categories/CTF/" class="post-category">
                                    CTF
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/shier_jinghuang/tags/Misc/">
                        <span class="chip bg-color">Misc</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
        
        <div class="article col s12 m6" data-aos="fade-up">
            <div class="article-badge right-badge text-color">
                下一篇&nbsp;<i class="fas fa-chevron-right"></i>
            </div>
            <div class="card">
                <a href="/shier_jinghuang/2021/07/31/%E5%9F%BA%E4%BA%8EC++%E7%9A%84%E5%8F%AF%E8%A7%86%E5%8C%96%E9%A3%9E%E6%9C%BA%E5%A4%A7%E6%88%98%E6%B8%B8%E6%88%8F/">
                    <div class="card-image">
                        
                        
                        <img src="/shier_jinghuang/medias/featureimages/10.jpg" class="responsive-img" alt="课程论文：基于C++的可视化飞机大战游戏">
                        
                        <span class="card-title">课程论文：基于C++的可视化飞机大战游戏</span>
                    </div>
                </a>
                <div class="card-content article-content">
                    <div class="summary block-with-text">
                        
                            
                        
                    </div>
                    <div class="publish-info">
                            <span class="publish-date">
                                <i class="far fa-clock fa-fw icon-date"></i>2021-07-31
                            </span>
                        <span class="publish-author">
                            
                            <i class="fas fa-bookmark fa-fw icon-category"></i>
                            
                            <a href="/shier_jinghuang/categories/%E5%AD%A6%E4%B9%A0%E7%AC%94%E8%AE%B0/" class="post-category">
                                    学习笔记
                                </a>
                            
                            
                        </span>
                    </div>
                </div>
                
                <div class="card-action article-tags">
                    
                    <a href="/shier_jinghuang/tags/%E5%9F%BA%E7%A1%80%E7%9F%A5%E8%AF%86/">
                        <span class="chip bg-color">基础知识</span>
                    </a>
                    
                </div>
                
            </div>
        </div>
        
    </div>
</article>

</div>



<!-- 代码块功能依赖 -->
<script type="text/javascript" src="/shier_jinghuang/libs/codeBlock/codeBlockFuction.js"></script>


  <!-- 是否加载使用自带的 prismjs. -->
  <script type="text/javascript" src="/shier_jinghuang/libs/prism/prism.min.js"></script>


<!-- 代码语言 -->

<script type="text/javascript" src="/shier_jinghuang/libs/codeBlock/codeLang.js"></script>


<!-- 代码块复制 -->

<script type="text/javascript" src="/shier_jinghuang/libs/codeBlock/codeCopy.js"></script>


<!-- 代码块收缩 -->

<script type="text/javascript" src="/shier_jinghuang/libs/codeBlock/codeShrink.js"></script>



    </div>
    <div id="toc-aside" class="expanded col l3 hide-on-med-and-down">
        <div class="toc-widget card" style="background-color: white;">
            <div class="toc-title"><i class="far fa-list-alt"></i>&nbsp;&nbsp;目录</div>
            <div id="toc-content"></div>
        </div>
    </div>
</div>

<!-- TOC 悬浮按钮. -->

<div id="floating-toc-btn" class="hide-on-med-and-down">
    <a class="btn-floating btn-large bg-color">
        <i class="fas fa-list-ul"></i>
    </a>
</div>


<script src="/shier_jinghuang/libs/tocbot/tocbot.min.js"></script>
<script>
    $(function () {
        tocbot.init({
            tocSelector: '#toc-content',
            contentSelector: '#articleContent',
            headingsOffset: -($(window).height() * 0.4 - 45),
            collapseDepth: Number('0'),
            headingSelector: 'h2, h3, h4'
        });

        // Set scroll toc fixed.
        let tocHeight = parseInt($(window).height() * 0.4 - 64);
        let $tocWidget = $('.toc-widget');
        $(window).scroll(function () {
            let scroll = $(window).scrollTop();
            /* add post toc fixed. */
            if (scroll > tocHeight) {
                $tocWidget.addClass('toc-fixed');
            } else {
                $tocWidget.removeClass('toc-fixed');
            }
        });

        
        /* 修复文章卡片 div 的宽度. */
        let fixPostCardWidth = function (srcId, targetId) {
            let srcDiv = $('#' + srcId);
            if (srcDiv.length === 0) {
                return;
            }

            let w = srcDiv.width();
            if (w >= 450) {
                w = w + 21;
            } else if (w >= 350 && w < 450) {
                w = w + 18;
            } else if (w >= 300 && w < 350) {
                w = w + 16;
            } else {
                w = w + 14;
            }
            $('#' + targetId).width(w);
        };

        // 切换TOC目录展开收缩的相关操作.
        const expandedClass = 'expanded';
        let $tocAside = $('#toc-aside');
        let $mainContent = $('#main-content');
        $('#floating-toc-btn .btn-floating').click(function () {
            if ($tocAside.hasClass(expandedClass)) {
                $tocAside.removeClass(expandedClass).hide();
                $mainContent.removeClass('l9');
            } else {
                $tocAside.addClass(expandedClass).show();
                $mainContent.addClass('l9');
            }
            fixPostCardWidth('artDetail', 'prenext-posts');
        });
        
    });
</script>

    

</main>




    <footer class="page-footer bg-color">
    
        <link rel="stylesheet" href="/shier_jinghuang/libs/aplayer/APlayer.min.css">
<style>
    .aplayer .aplayer-lrc p {
        
        display: none;
        
        font-size: 12px;
        font-weight: 700;
        line-height: 16px !important;
    }

    .aplayer .aplayer-lrc p.aplayer-lrc-current {
        
        display: none;
        
        font-size: 15px;
        color: #42b983;
    }

    
    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
        left: -66px !important;
    }

    .aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
        left: 0px !important;
    }

    
</style>
<div class="">
    
    <div class="row">
        <meting-js class="col l8 offset-l2 m10 offset-m1 s12"
                   server="netease"
                   type="playlist"
                   id="503838841"
                   fixed='true'
                   autoplay='false'
                   theme='#42b983'
                   loop='all'
                   order='random'
                   preload='auto'
                   volume='0.7'
                   list-folded='true'
        >
        </meting-js>
    </div>
</div>

<script src="/shier_jinghuang/libs/aplayer/APlayer.min.js"></script>
<script src="/shier_jinghuang/libs/aplayer/Meting.min.js"></script>

    

    <div class="container row center-align"
         style="margin-bottom: 0px !important;">
        <div class="col s12 m8 l8 copy-right">
            Copyright&nbsp;&copy;
            
                <span id="year">2019-2023</span>
            
            <a href="/shier_jinghuang/about" target="_blank">十二惊惶</a>
            |&nbsp;Powered by&nbsp;<a href="https://hexo.io/" target="_blank">Hexo</a>
            |&nbsp;Theme&nbsp;<a href="https://github.com/blinkfox/hexo-theme-matery" target="_blank">Matery</a>
            <br>
            
                &nbsp;<i class="fas fa-chart-area"></i>&nbsp;站点总字数:&nbsp;<span
                        class="white-color">289.6k</span>
            
            
            
                
            
            
                <span id="busuanzi_container_site_pv">
                &nbsp;|&nbsp;<i class="far fa-eye"></i>&nbsp;总访问量:&nbsp;
                    <span id="busuanzi_value_site_pv" class="white-color"></span>
            </span>
            
            
                <span id="busuanzi_container_site_uv">
                &nbsp;|&nbsp;<i class="fas fa-users"></i>&nbsp;总访问人数:&nbsp;
                    <span id="busuanzi_value_site_uv" class="white-color"></span>
            </span>
            
            <br>

            <!-- 运行天数提醒. -->
            
            <br>
            
        </div>
        <div class="col s12 m4 l4 social-link social-statis">
    <a href="https://github.com/blinkfox" class="tooltipped" target="_blank" data-tooltip="访问我的GitHub" data-position="top" data-delay="50">
        <i class="fab fa-github"></i>
    </a>



    <a href="mailto:1181062873@qq.com" class="tooltipped" target="_blank" data-tooltip="邮件联系我" data-position="top" data-delay="50">
        <i class="fas fa-envelope-open"></i>
    </a>







    <a href="tencent://AddContact/?fromId=50&fromSubId=1&subcmd=all&uin=1181062873" class="tooltipped" target="_blank" data-tooltip="QQ联系我: 1181062873" data-position="top" data-delay="50">
        <i class="fab fa-qq"></i>
    </a>







    <a href="/shier_jinghuang/atom.xml" class="tooltipped" target="_blank" data-tooltip="RSS 订阅" data-position="top" data-delay="50">
        <i class="fas fa-rss"></i>
    </a>

</div>
    </div>
</footer>

<div class="progress-bar"></div>


    <!-- 搜索遮罩框 -->
<div id="searchModal" class="modal">
    <div class="modal-content">
        <div class="search-header">
            <span class="title"><i class="fas fa-search"></i>&nbsp;&nbsp;搜索</span>
            <input type="search" id="searchInput" name="s" placeholder="请输入搜索的关键字"
                   class="search-input">
        </div>
        <div id="searchResult"></div>
    </div>
</div>

<script type="text/javascript">
$(function () {
    var searchFunc = function (path, search_id, content_id) {
        'use strict';
        $.ajax({
            url: path,
            dataType: "xml",
            success: function (xmlResponse) {
                // get the contents from search data
                var datas = $("entry", xmlResponse).map(function () {
                    return {
                        title: $("title", this).text(),
                        content: $("content", this).text(),
                        url: $("url", this).text()
                    };
                }).get();
                var $input = document.getElementById(search_id);
                var $resultContent = document.getElementById(content_id);
                $input.addEventListener('input', function () {
                    var str = '<ul class=\"search-result-list\">';
                    var keywords = this.value.trim().toLowerCase().split(/[\s\-]+/);
                    $resultContent.innerHTML = "";
                    if (this.value.trim().length <= 0) {
                        return;
                    }
                    // perform local searching
                    datas.forEach(function (data) {
                        var isMatch = true;
                        var data_title = data.title.trim().toLowerCase();
                        var data_content = data.content.trim().replace(/<[^>]+>/g, "").toLowerCase();
                        var data_url = data.url;
                        data_url = data_url.indexOf('/') === 0 ? data.url : '/' + data_url;
                        var index_title = -1;
                        var index_content = -1;
                        var first_occur = -1;
                        // only match artiles with not empty titles and contents
                        if (data_title !== '' && data_content !== '') {
                            keywords.forEach(function (keyword, i) {
                                index_title = data_title.indexOf(keyword);
                                index_content = data_content.indexOf(keyword);
                                if (index_title < 0 && index_content < 0) {
                                    isMatch = false;
                                } else {
                                    if (index_content < 0) {
                                        index_content = 0;
                                    }
                                    if (i === 0) {
                                        first_occur = index_content;
                                    }
                                }
                            });
                        }
                        // show search results
                        if (isMatch) {
                            str += "<li><a href='" + data_url + "' class='search-result-title'>" + data_title + "</a>";
                            var content = data.content.trim().replace(/<[^>]+>/g, "");
                            if (first_occur >= 0) {
                                // cut out 100 characters
                                var start = first_occur - 20;
                                var end = first_occur + 80;
                                if (start < 0) {
                                    start = 0;
                                }
                                if (start === 0) {
                                    end = 100;
                                }
                                if (end > content.length) {
                                    end = content.length;
                                }
                                var match_content = content.substr(start, end);
                                // highlight all keywords
                                keywords.forEach(function (keyword) {
                                    var regS = new RegExp(keyword, "gi");
                                    match_content = match_content.replace(regS, "<em class=\"search-keyword\">" + keyword + "</em>");
                                });

                                str += "<p class=\"search-result\">" + match_content + "...</p>"
                            }
                            str += "</li>";
                        }
                    });
                    str += "</ul>";
                    $resultContent.innerHTML = str;
                });
            }
        });
    };

    searchFunc('/shier_jinghuang/search.xml', 'searchInput', 'searchResult');
});
</script>

    <!-- 白天和黑夜主题 -->
<div class="stars-con">
    <div id="stars"></div>
    <div id="stars2"></div>
    <div id="stars3"></div>  
</div>

<script>
    function switchNightMode() {
        $('<div class="Cuteen_DarkSky"><div class="Cuteen_DarkPlanet"></div></div>').appendTo($('body')),
        setTimeout(function () {
            $('body').hasClass('DarkMode') 
            ? ($('body').removeClass('DarkMode'), localStorage.setItem('isDark', '0'), $('#sum-moon-icon').removeClass("fa-sun").addClass('fa-moon')) 
            : ($('body').addClass('DarkMode'), localStorage.setItem('isDark', '1'), $('#sum-moon-icon').addClass("fa-sun").removeClass('fa-moon')),
            
            setTimeout(function () {
            $('.Cuteen_DarkSky').fadeOut(1e3, function () {
                $(this).remove()
            })
            }, 2e3)
        })
    }
</script>

    <!-- 回到顶部按钮 -->
<div id="backTop" class="top-scroll">
    <a class="btn-floating btn-large waves-effect waves-light" href="#!">
        <i class="fas fa-arrow-up"></i>
    </a>
</div>


    <script src="/shier_jinghuang/libs/materialize/materialize.min.js"></script>
    <script src="/shier_jinghuang/libs/masonry/masonry.pkgd.min.js"></script>
    <script src="/shier_jinghuang/libs/aos/aos.js"></script>
    <script src="/shier_jinghuang/libs/scrollprogress/scrollProgress.min.js"></script>
    <script src="/shier_jinghuang/libs/lightGallery/js/lightgallery-all.min.js"></script>
    <script src="/shier_jinghuang/js/matery.js"></script>

    

    

    <!-- 雪花特效 -->
    

    <!-- 鼠标星星特效 -->
    

     
        <script src="https://ssl.captcha.qq.com/TCaptcha.js"></script>
        <script src="/shier_jinghuang/libs/others/TencentCaptcha.js"></script>
        <button id="TencentCaptcha" data-appid="xxxxxxxxxx" data-cbfn="callback" type="button" hidden></button>
    

    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <script src="/shier_jinghuang/libs/others/clicklove.js" async="async"></script>
    
    
    <script async src="/shier_jinghuang/libs/others/busuanzi.pure.mini.js"></script>
    

    

    

    <!--腾讯兔小巢-->
    
    

    

    

    
    <script src="/shier_jinghuang/libs/instantpage/instantpage.js" type="module"></script>
    

</body>

</html>
